package com.atguigu.springcloud.controller;

import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.cloud.stream.messaging.Sink;
import org.springframework.messaging.Message;
import org.springframework.stereotype.Component;

/**
 * @author ：jjt8024
 * @date ：Created in 2021/3/13 9:10
 */

@EnableBinding(Sink.class)
@Component
public class ConsumerController {

    @Value("${server.port}")
    private String port;

    @StreamListener(Sink.INPUT)
    public void getMsg(Message<String> message){
        System.out.println(port+"  消费者，接收到的消息：  "+message.getPayload());
    }
}


